- Now we can
filter the gapminder dataset first, then use two inner joins to reduce the World Bank dataset to European countries
- Joins are very similar
filter if you think about it
gapminder was reduced to a smaller dataset and then subsequent joins reduced the size of country_codes and then world_bank_pop
gapminder %>%
filter(continent == "Europe") %>%
distinct(country) %>%
inner_join(country_codes, "country") %>%
inner_join(world_bank_pop, c("iso_alpha" = "country")) %>%
sample_n(3)
## # A tibble: 3 × 22
## country iso_alpha iso_num indicator `2000` `2001` `2002` `2003` `2004` `2005`
## <chr> <chr> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Romania ROU 642 SP.POP.GR… -0.129 -1.40 -1.83 -0.721 -0.570 -0.618
## 2 Albania ALB 8 SP.URB.GR… 0.742 0.710 2.18 2.06 1.97 1.83
## 3 Romania ROU 642 SP.URB.GR… -0.420 -1.68 -1.97 -0.471 -0.323 -0.371
## # … with 12 more variables: 2006 <dbl>, 2007 <dbl>, 2008 <dbl>, 2009 <dbl>,
## # 2010 <dbl>, 2011 <dbl>, 2012 <dbl>, 2013 <dbl>, 2014 <dbl>, 2015 <dbl>,
## # 2016 <dbl>, 2017 <dbl>